package com.shankungfu.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 自动播放
 * @author WangQing
 * 2013-8-13
 */
public class PushMessageKeeper {
	private static final String PREFERENCES_NAME = "com_cyou_push_message_Switch";
	private static final String pushMessage = "is_push_message";


    /**
     * 存 推送开关 数据到 SharedPreferences 里面
     * @param context
     * @param Push_Message
     */
	public static void keepPushMessage(Context context,Boolean Push_Message) { 
		SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND);
		Editor editor = pref.edit();
		//TODO
		editor.putBoolean(pushMessage, Push_Message);
		editor.commit();
	}
	
	/**
	 * 获取 对应SharedPreferences 里面的数据
	 * WangQing
	 * 2013-8-13
	 * Object
	 * @param context
	 * @return
	 */
	public static Boolean readPushMessage(Context context){ 
		SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND);
		//TODO
		boolean isForbid = pref.getBoolean(pushMessage, true);
		return isForbid;
	}
	
	/**
	 * 清空 对应SharedPreferences 里面的文件
	 * WangQing
	 * 2013-8-13
	 * void
	 * @param context
	 */
	public static void clear(Context context){
	    SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND);
	    Editor editor = pref.edit();
	    editor.clear();
	    editor.commit();
	}

}
